home *** CD-ROM | disk | FTP | other *** search
/ PC Media 2 / PC MEDIA CD02.iso / share / udos / fgrep103 / grep.doc < prev    next >
Encoding:
Text File  |  1991-04-05  |  2.1 KB  |  60 lines

  1.  
  2.  
  3.  
  4.      GREP
  5.  
  6.  
  7.  
  8.      NAME
  9.           grep - search a file for a pattern
  10.  
  11.      SYNOPSIS
  12.           grep [ options ] expression [ files ]
  13.  
  14.      DESCRIPTION
  15.           Commands of the grep family search the input files (standard
  16.           input default) for lines matching a pattern.  Normally, each
  17.           line found is copied to the standard output.  The following
  18.           options are recognized:
  19.  
  20.           -x    (Exact) only lines matched in their entirety are
  21.                 printed.
  22.           -c    Only a count of matching lines is printed.
  23.           -m    Do not ignore upper/lower case distinction during
  24.                 comparisons (default is ignore case).
  25.           -l    Only the names of files with matching lines are listed
  26.                 (once).
  27.           -n    Each line is preceded by its relative byte number in
  28.                 the file.
  29.           -s    The error messages produced for nonexistent or
  30.                 unreadable files are suppressed.
  31.           -e expression
  32.                 Same as a simple expression argument, but useful when
  33.                 the expression begins with a "-".
  34.           -f file
  35.                 The strings list is taken from the file.
  36.           -h
  37.                 Printing of the file names is suppressed.
  38.  
  39.           In all cases, the file name is output if there is more than
  40.           one input file.  It is safest to enclose the entire
  41.           expression argument in double quotes "...".
  42.  
  43.           You may include more than one file specification on the
  44.           command line.  For example
  45.  
  46.                 grep -m test *.c *.h
  47.  
  48.           This will search all files in the default directory of the
  49.           form *.c and *.h for all occurrences of the word "test".
  50.  
  51.      DIAGNOSTICS
  52.           Exit status is 0 if any matches are found, 1 if none, 2 for
  53.           syntax errors or inaccessible files (even if matches were
  54.           found).
  55.  
  56.      BUGS
  57.           Ideally grep would print the line number in which the string
  58.           was found.  Because the Boyer-Moore algorithm (which uses a
  59.           skip pattern) is used this is not possible.
  60.